package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatCompany;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LF
 * @since 2020-08-24
 */
@Controller
@RequestMapping("/WeChatUser/wechatCompany")
public class WechatCompanyController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "WechatCompany/WechatCompanyMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatCompanyHtml")
    public String addWechatCompanyHtml( ){
             return "WechatCompany/WechatCompanyAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatCompanyHtml")
    public String editWechatCompanyHtml(Integer id ,Model model ){
           model.addAttribute("wechatCompany",wechatCompanyService.selectWechatCompanyByIdWechatCompany(id));
             return "WechatCompany/WechatCompanyEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatCompanyHtml")
    public String showWechatCompanyHtml(Integer id ,Model model ){
           model.addAttribute("wechatCompany",wechatCompanyService.selectWechatCompanyByIdWechatCompany(id));
             return "WechatCompany/WechatCompanyShow";
    }


    /** 分页查询WechatCompany
     * @param page  页码
     * @param limit  查几条
     * @param wechatCompany  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatCompanyByPage")
    @ResponseBody
    public ResultPage findWechatCompanyByPage(Integer page, Integer limit,WechatCompany wechatCompany){
             return wechatCompanyService.findWechatCompanyByPage(page,limit,wechatCompany);
    }

    /** 添加WechatCompany
     * @param wechatCompany  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatCompany")
    @ResponseBody
    public ApiResultModel saveWechatCompany(WechatCompany wechatCompany  ){
             return wechatCompanyService.addWechatCompany(wechatCompany);
    }

    /** 编辑WechatCompany
     * @param wechatCompany  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatCompany")
    @ResponseBody
    public ApiResultModel editWechatCompany(WechatCompany wechatCompany  ){
             return wechatCompanyService.editWechatCompany(wechatCompany);
    }



    /** 删除一条WechatCompany
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatCompany")
    @ResponseBody
    public ApiResultModel delWechatCompany( Integer id  ){
             return wechatCompanyService.delWechatCompany(id);
    }


}
